<template>
<div class="main">
    <van-swipe :loop="false" :autoplay="2000" @change="onChange">
          <van-swipe-item v-for="(item, index) in images" :key="index">
              <img :src="item">
          </van-swipe-item>
    </van-swipe>
    <button v-show="hide" @click="goHome">立即体验</button>
    </div>
</template>

<script>
export default {
data() {
    return {
        hide: false,
      images: [
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201508%2F21%2F20150821095016_VFQkY.thumb.700_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642681133&t=f09633ce3c5ae5b9952df41b4c11f4f9',
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic4.zhimg.com%2Fv2-46b58d6ac3ba1c540781cd2647f20800_r.jpg%3Fsource%3D1940ef5c&refer=http%3A%2F%2Fpic4.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642681261&t=ab88ea3b828d18aa3bf7f42ad20f250e',
        "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fmobile%2F4%2F55c86c4236b88.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642681133&t=ef783e1289d649f58e93fef95289d804"
      ],
    };
  },
  methods:{
     onChange(index){
         if(index==2){
             this.hide = true
         }
     },
     goHome(){
         this.$router.push({path: "/home"})
     }
  }
}
</script>

<style lang="less" scoped>
.main{
    position: relative;

.van-swipe{
    width: 100%;
    height: 100%;
    img{
        width: 100%;
        height: 100%;
    }
}
button{
        font-size: 12px;
    color: #ffffff;
    background: #ff5555;
    opacity: 0.8;
    // background: #1989fa;
    border: none;
    border-radius: 5px;
        position: absolute;
    left: 50%;
    bottom: 25px;
    transform: translate(-50%, -70%);
}
}
</style>